package com.party.admin.biz.analysis;

import com.party.core.utils.MyBeanUtils;
import com.party.common.utils.StringUtils;
import com.party.core.model.analysis.StatisticsEvent;
import com.party.core.service.analysis.IStatisticsEventService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @program: Project
 * @description: 统计事件服务
 * @author: Huaqunhao
 * @create: 2018-08-02 15:28
 **/
@Service
@Transactional
public class StatisticalEventBizService {
    @Autowired
    private IStatisticsEventService statisticsEventService;


    public void saveOrupdate(StatisticsEvent se) throws Exception {
        //更新
        if (StringUtils.isNotBlank(se.getId())) {

            StatisticsEvent seed = statisticsEventService.get(se.getId());
            MyBeanUtils.copyBeanNotNull2Bean(se, seed);
            statisticsEventService.update(seed);

        }
        //新增
        else {
            statisticsEventService.insert(se);
        }
    }
}
